<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <ul>
        <li>苹果</li><li>香蕉</li><li>葡萄</li><li>西瓜</li>
    </ul>
    <ol id="ol">
        <li>红色</li><li>绿色</li><li>黄色</li><li>蓝色</li>
    </ol>
    <script>
        //法1：
        var ol = document.getElementsByTagName('ol');  //伪数组形式不可以作为父元素
        console.log(ol[0].getElementsByTagName('li')); //父元素必须是单个对象(必须指明是哪一个元素)
        //法2：
        var ol = document.getElementById('ol');
        console.log(ol.getElementsByTagName('li'));
    </script>
</body>
</html>